home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
ptv1n4.arc
/
SETS.MTH
< prev
next >
Wrap
Text File
|
1990-09-13
|
845b
|
41 lines
intersect: aSet
"Return the intersection of two sets"
^ self select: [: anObject |
aSet includes: anObject
].
isSubsetOf: aSet
"Return true if self is a subset of aSet"
^ (self select: [: anObject |
aSet includes: anObject
]) size = (self size).
notIntersect: aSet
"Return the set of everything but
the intersection of self and aSet"
^ (self select: [: anObject |
(aSet includes: anObject) not
]) union: (aSet select: [: anObject |
(self includes: anObject) not
]).
union: aSet
"Return the union of two sets"
| newSet |
newSet := Set new.
self do: [: anObject |
newSet add: anObject
].
aSet do: [: anObject |
newSet add: anObject
].
^ newSet.